﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ComparisonLeft.aspx.cs"
	Inherits="HZ.Supervise.Web.PageControl.ComparisonLeft" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title></title>
	<link rel="stylesheet" type="text/css" href="../Style/s-type.css" />

	<script src="../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>

	<script src="../Scripts/DynaForm.js" type="text/javascript"></script>

	<script src="../Scripts/GenUtils.js" type="text/javascript"></script>

	<script src="../Scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

	<link rel="Stylesheet" type="text/css" href="../Style/style.css" />

	<script type="text/javascript">

		//董辉 2011-4-13 12:27
		//将后台回发事件改成前台JS控制，防止出现事件回调
		$(document).ready(function() {
			//初始化
			display();

			//注册按钮点击事件
			$("#Run").click(function() {
				//开始时间
				var StartTime = $("#txtTimeFrom").val();

				//结束时间
				var EndTime = $("#txtTimeTo").val();

				//获取选中的单选按钮值
				var RadioValue = $(":radio[name='RadioButtonList1'][checked]").val();

				//获取选中的医院
				var HostpitalNames = $("#HidHosId").val();

				//获取选中的地区
				var Areas = $("#HidAreaId").val();

				//获取选中的药品
				var Pros = $("#HidProId").val();

				if (StartTime != "" && EndTime == "") {

					alert("请选择要对比的起始时间或结束时间！");

					return false;
				}
				else if (StartTime == "" && EndTime != "") {

					alert("请选择要对比的起始时间或结束时间！");

					return false;
				}

				if (StartTime > EndTime) {

					alert("起始时间应该小于或等于结束时间！");

					return false;

				}

				if (RadioValue != "") {
					switch (RadioValue) {
						//医院对比                                  
						case "1":
							if (HostpitalNames == "") {
								alert("请选择要对比的医院！");
							}
							else {
								//调用页面并传值
								seturl1(HostpitalNames, StartTime, EndTime, "");

							}
							break;

						//地区对比                              
						case "2":
							if (Areas == "") {
								alert("请选择要对比的地区！");
							}
							else {
								seturl2(Areas, StartTime, EndTime, "");

								//清空地区隐藏域值
								//$("#HidAreaId").val("");

								//清空页面上地区集合
								//$("#txtAreaName").val("");
							}
							break;

						//药品对比                         
						case "3":
							if (Pros == "") {
								alert("请选择要对比的药品！");
							}
							else {
								seturl4(Pros, StartTime, EndTime, "");

								//清空药品隐藏域值
								//$("#HidProId").val("");

								//$("#txtProName").val("");
							}
							break;
					}
				}
			});
		});

		function display() {
			//肖梦兰 防止页面加载radioButton状态改变
			if (document.getElementById("RadioButtonList1_1").checked != true && document.getElementById("RadioButtonList1_2").checked != true) {
				document.getElementById("divHos").style.display = "block";
				document.getElementById("divArea").style.display = "none";
				document.getElementById("divPro").style.display = "none";

			}
			else if (document.getElementById("RadioButtonList1_1").checked == true) {
				document.getElementById("divHos").style.display = "none";
				document.getElementById("divArea").style.display = "block";
				document.getElementById("divPro").style.display = "none";

			}
			else if (document.getElementById("RadioButtonList1_2").checked == true) {
				document.getElementById("divHos").style.display = "none";
				document.getElementById("divArea").style.display = "none";
				document.getElementById("divPro").style.display = "block";
			}
		}

		function check() {
			if (document.getElementById("RadioButtonList1_0").checked == true) {
				document.getElementById("divHos").style.display = "block";
				document.getElementById("divArea").style.display = "none";
				document.getElementById("divPro").style.display = "none";
			}
			else if (document.getElementById("RadioButtonList1_1").checked == true) {
				document.getElementById("divHos").style.display = "none";
				document.getElementById("divArea").style.display = "block";
				document.getElementById("divPro").style.display = "none";
			}
			else if (document.getElementById("RadioButtonList1_2").checked == true) {
				document.getElementById("divHos").style.display = "none";
				document.getElementById("divArea").style.display = "none";
				document.getElementById("divPro").style.display = "block";
			}
		}

		function insertHosInfo(hos) {
			var varhosInfo = hos.split('|');
			document.getElementById("HidHosId").value = varhosInfo[1];
			document.getElementById("txtHosName").value = varhosInfo[0];
		}

		function insertAreaInfo(area) {
			var varhosInfo = area.split('|');
			document.getElementById("HidAreaId").value = varhosInfo[1];
			document.getElementById("txtAreaName").value = varhosInfo[0];
		}
		function insertProInfo(area) {
			var varhosInfo = area.split('|');
			document.getElementById("HidProId").value = varhosInfo[1];
			document.getElementById("txtProName").value = varhosInfo[0];
		}
		function seturl1(hosid, timefrom, timeto, sid) {//更改iframe内容
			CallFunc('../Secondphase/Comparison/ComparisonByHospital.aspx?Hid=' + encodeURI(hosid) + '&timefrom=' + encodeURI(timefrom) + '&timeto=' + encodeURI(timeto) + '&sid=' + encodeURI(sid), 'FORM', null, 'Main');
			//            CallFunc('../Secondphase/Comparison/ComparisonByHospital.aspx?Hid=' + encodeURI(hosid) + '&sid=' + encodeURI(sid), 'FORM', null, 'Main');

		}
		function seturl2(areaid, timefrom, timeto, sid) {//更改iframe内容
			CallFunc('../Secondphase/Comparison/ComparisonByArea.aspx?Aid=' + encodeURI(areaid) + '&timefrom=' + encodeURI(timefrom) + '&timeto=' + encodeURI(timeto) + '&sid=' + encodeURI(sid), 'FORM', null, 'Main');

		}

		function seturl4(Proid, timefrom, timeto, sid) {//更改iframe内容
			CallFunc('../Secondphase/Comparison/ComparisonByPro.aspx?Pid=' + encodeURI(Proid) + '&timefrom=' + encodeURI(timefrom) + '&timeto=' + encodeURI(timeto) + '&sid=' + encodeURI(sid), 'FORM', null, 'Main');
		}

	</script>

	<style type="text/css">
		.style1
		{
			width: 100px;
		}
	</style>
</head>
<body>
	<form id="form1" runat="server">
	<div id="main">
		<div class="left">
			<div class="left1">
				<h1 class="leftTitle1">
					欢迎您！</h1>
				<ul>
					<li>
						<asp:Label ID="lblCurrentUser" runat="server" Text="Label"></asp:Label></li>
					<li>当前角色：
						<asp:Label ID="lblCurrentRole" runat="server" Text="Label"></asp:Label></li>
				</ul>
			</div>
			<div class="left2">
				<h1 class="leftTitle2">
					检索</h1>
				<ul>
					<asp:RadioButtonList ID="RadioButtonList1" name="RadioButtonList1" runat="server"
						Width="91%" CellPadding="1" CellSpacing="0" Height="18px" RepeatDirection="Horizontal"
						onclick="check();">
						<asp:ListItem Value="1" Text="医院对比" Selected="True"></asp:ListItem>
						<asp:ListItem Value="2" Text="地区对比"></asp:ListItem>
						<asp:ListItem Value="3" Text="药品对比"></asp:ListItem>
					</asp:RadioButtonList>
				</ul>
			</div>
			<div class="left3">
				<div id="divHos">
					<table width="72%">
						<tr style="height: 25px">
							<td class="style1">
								要对比医院:
							</td>
							<td align="left">
								<input type="button" id="btnHos" value="选择医院" class="btn" style="margin-right: 20px"
									onclick="window.open('../Common/FindAllHospital1.aspx','123','width=1000,height=500,resizable=0,scrollbars=0, status=0, toolbar=0, menubar=0')" />
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<input id="HidHosId" type="hidden" name="HidHosId" runat="server" />
								<asp:TextBox ID="txtHosName" runat="server" Height="177px" TextMode="MultiLine" Width="184px" 
									Visible="true" Enabled="false"></asp:TextBox>
							</td>
						</tr>
					</table>
				</div>
				<div id="divArea" style="display: none">
					<table width="60%">
						<tr style="height: 25px">
							<td class="style1">
								要对比地区:
							</td>
							<td align="left">
								<input type="button" id="btnArea" runat="server" value="选择地区" class="btn" style="margin-right: 20px"
									onclick="window.open('../Common/FindAllArea1.aspx','123','width=1000,height=500,resizable=0,scrollbars=0, status=0, toolbar=0, menubar=0')" />
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<input id="HidAreaId" type="hidden" name="HidAreaId" runat="server" />
								<asp:TextBox ID="txtAreaName" runat="server" Height="177px" TextMode="MultiLine"
									Width="184px" Visible="true" Enabled="false"></asp:TextBox>
							</td>
						</tr>
					</table>
				</div>
				<div id="divPro" style="display: none">
					<table width="72%">
						<tr style="height: 25px">
							<td class="style1">
								要对比药品:
							</td>
							<td align="left">
								<input type="button" id="Button3" runat="server" value="选择药品" class="btn" style="margin-right: 20px"
									onclick="window.open('../Common/FindAllProductName1.aspx','123','width=1000,height=500,resizable=0,scrollbars=0, status=0, toolbar=0, menubar=0')" />
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<input id="HidProId" type="hidden" name="HidAreaId" runat="server" />
								<asp:TextBox ID="txtProName" runat="server" Height="177px" TextMode="MultiLine" Width="184px"
									Visible="true" Enabled="false"></asp:TextBox>
							</td>
						</tr>
					</table>
				</div>
				<table>
					<tr>
						<td rowspan="2" style="width: auto">
							选择时间：
						</td>
						<td>
							<span style="float: left">从</span><asp:TextBox ID="txtTimeFrom" runat="server" Width="105px"
								onFocus="WdatePicker({dateFmt:'yyyyMM'})"></asp:TextBox>
						</td>
					</tr>
					<tr>
						<td>
							<span style="float: left">到</span><asp:TextBox ID="txtTimeTo" runat="server" Width="105px"
								onFocus="WdatePicker({dateFmt:'yyyyMM'})"></asp:TextBox>
						</td>
					</tr>
					<tr>
						<td class="style1">
						</td>
						<td align="left" style="padding-right: 20px">
							<hz:HzButton ID="Run" runat="server" Text="对 比" CssClass="btn" SkinID="search"  ModuleNo="对比统计" OperateType =" 对比" />
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
	</form>
</body>
</html>
